﻿/////////////////////////////////////////////////////////////////
//File: BlogSystemInfo.cs
//Description: 
//Copyright© 2012 Moliu
//History:
//  2012-05-27 09:26:02    moliu    
/////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using MAF.Common;
using My.Blog.Repository;

namespace My.Blog
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public class BlogSystem : BaseEntity
    {
        /// <summary>
        /// 注册博客
        /// </summary>
        /// <param name="blog"></param>
        public void Register(MyBlog blog)
        {
            BlogRepo.Blogs.Add(blog);
        }

        /// <summary>
        /// 获取博客列表
        /// </summary>
        /// <returns></returns>
        public List<MyBlog> GetBlogs()
        {
            return BlogRepo.Blogs.GetByQuery(null);
        }

        /// <summary>
        /// 获取指定的博客
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public MyBlog GetBlog(Guid id)
        {
            return BlogRepo.Blogs.GetById(id);
        }

        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <returns></returns>
        public List<Article> GetArticles()
        {
            return BlogRepo.Articles.GetByQuery(null);
        }

        /// <summary>
        /// 获取指定文章
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Article GetArticle(Guid id)
        {
            return BlogRepo.Articles.GetById(id);
        }

        /// <summary>
        /// 获取评论列表
        /// </summary>
        /// <returns></returns>
        public List<Comment> GetComments()
        {
            return BlogRepo.Comments.GetByQuery(null);
        }

        /// <summary>
        /// 获取指定评论共
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Comment GetComment(Guid id)
        {
            return BlogRepo.Comments.GetById(id);
        }
    }
}